<template>
  <div class="home">
    <h1>{{$route.params.id}}</h1>
    <ul-button type="primary" @click="back">back</ul-button>
    <ul-button type="primary" @click="toItem">to item</ul-button>
    <!-- <ul-image 
      style="width: 100px; height: 100px"
      src="https://leicloud.ulearning.cn//tongsk/contentmanage/85bcde8d-b5ba-4e72-9db3-b18d9924af4d.JPG" 
      :preview-src-list="imgList"
      >
    </ul-image> -->
    <!-- <el-button type="primary">element-ui</el-button> -->
    <!-- <ul-editor></ul-editor> -->
    <el-scrollbar
    tag="div"
    wrap-class="list-wrapper"
    ref="scrollbar"
    class="scrollbar-wrapper"
    wrapStyle="height:500px;"
    >
    <ul class="infinite-list" v-infinite-scroll="load" infinite-scroll-delay="200">
      <li v-for="i in count" @click="toList(i)" class="infinite-list-item" :key="i" style="height:50px;margin:10px;background-color:green;">{{ i }}</li>
    </ul>
    </el-scrollbar>
  </div>
</template>

<script>
// @ is an alias to /src
export default {
  name: 'Home',
  data () {
    return {
      imgList: [{
        url: 'https://leicloud.ulearning.cn//tongsk/contentmanage/85bcde8d-b5ba-4e72-9db3-b18d9924af4d.JPG',
        name: '第一张图.png'
      },{
        url: 'https://leicloud.ulearning.cn/resources/972721/201811141823364022',
        name: '第二张图.jpg'
      }],
      count: 5
    }
  },
  methods: {
    showImgViewer () {
      this.$viewImage({
        imgList: [{
          url: 'https://leicloud.ulearning.cn//tongsk/contentmanage/85bcde8d-b5ba-4e72-9db3-b18d9924af4d.JPG',
          name: '第一张图.png'
        },{
          url: 'https://leicloud.ulearning.cn/resources/972721/201811141823364022',
          name: '第二张图.jpg'
        }]
      })
    },
     load () {
      //  this.count += 2
        console.log(111)
      },
      toList (i) {
        this.$router.push({
          path: '/list/' + i
        })
      },
      toItem (i) {
        this.$router.push({
          path: '/item'
        })
      },
      back () {
        this.$router.goBack()
      }
  }
}
</script>
